package cloud.xlh.my_system.controller.admin.Idempotent;


import cloud.xlh.my_system.service.EmpService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

/**
 * Created with IntelliJ IDEA.
 *
 * @ project name : xlh_osms
 * @ Author: XuLeHuang
 * @ Date: 2022/5/27 15:15
 * @ Description:
 */
@Controller
@RequestMapping("/emp")
public class EmpController {

    @Autowired
    private EmpService empService;

    //@Retryable(value = Exception.class, maxAttempts = 3, backoff = @Backoff(delay = 1000L, multiplier = 2))
    /*@Idempotent*/
    @RequestMapping("/updateSalary")
    @ResponseBody
    public String updateSalary() throws Exception {
        String id = "1457194479344693248";
        String add = "1";
        return empService.updateSalary(id , add);
    }

    //@Recover
    public void recover(Exception e) {
        // 回调方法,业务逻辑处理
        System.out.println("重试方法异常回调");;
    }
}
